<template>
  <div>
    <div v-if="showIframe" class="iframe-modal">
      <div class="iframe-background" @click="closeIframe"></div>
      <div class="ad-container">
        <div class="close-btn" @click="closeIframe">
          <div class="close-btn-text"></div>
        </div>
        <iframe
          class="ad-iframe"
          src="https://tnaot.com/ad6.html"
          frameborder="0"
        ></iframe>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Ad6Html',
  data() {
    return {
      showIframe: true
    };
  },
  methods: {
    closeIframe() {
      this.showIframe = false;
    }
  },
  mounted() {
    const that = this;
    this.randomNumber = new Date().getTime();
    setTimeout(() => {
      that.closeIframe();
    }, 4000);
  }
};
</script>

<style lang="scss" scoped>
@import '~assets/styles/variable.scss';

.iframe-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;

  .ad-container {
    width: 900px;
    height: 500px;
    position: relative;
    z-index: 1;
    cursor: pointer;
    .ad-iframe {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      margin: auto;
      width: 100%;
      height: 100%;
    }

    .close-btn {
      position: absolute;
      top: 8px;
      right: 8px;
      width: 24px;
      height: 24px;
      line-height: 24px;
      text-align: center;

      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      cursor: pointer;
      z-index: 2;
    }

    .ad-content {
      width: 100%;
      height: 100%;
    }
  }
}
</style>
